Optimal. Leaf size=82 \[ -\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3745, 474, 470,
327, 213} \begin {gather*} -\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 213
Rule 327
Rule 470
Rule 474
Rule 3745
Rubi steps
\begin {align*} \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {x^2 \left (a-b+b x^2\right )^2}{\left (-1+x^2\right )^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {\text {Subst}\left (\int \frac {x^2 \left (a^2+4 a b-2 b^2+2 b^2 x^2\right )}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}+\frac {(a (a+4 b)) \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}+\frac {(a (a+4 b)) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=-\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(231\) vs. \(2(82)=164\).
time = 5.46, size = 231, normalized size = 2.82 \begin {gather*} \frac {\left (24 a b+8 b^2+24 a b \cos (2 (e+f x))-12 a b \cos (3 (e+f x))-b^2 \cos (3 (e+f x))-12 a^2 \cos ^2(e+f x) \cot ^2(e+f x)-3 a^2 \cos (3 (e+f x)) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )-12 a b \cos (3 (e+f x)) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )+3 a^2 \cos (3 (e+f x)) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )+12 a b \cos (3 (e+f x)) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )-3 \cos (e+f x) \left (b (12 a+b)+3 a (a+4 b) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )-3 a (a+4 b) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )\right ) \sec ^3(e+f x)}{24 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 85, normalized size = 1.04
method | result | size |
derivativedivides | \(\frac {\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) | \(85\) |
default | \(\frac {\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) | \(85\) |
risch | \(\frac {3 a^{2} {\mathrm e}^{9 i \left (f x +e \right )}+12 a b \,{\mathrm e}^{9 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{7 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{7 i \left (f x +e \right )}+18 a^{2} {\mathrm e}^{5 i \left (f x +e \right )}-24 a b \,{\mathrm e}^{5 i \left (f x +e \right )}-16 b^{2} {\mathrm e}^{5 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{3 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{3 i \left (f x +e \right )}+3 a^{2} {\mathrm e}^{i \left (f x +e \right )}+12 a b \,{\mathrm e}^{i \left (f x +e \right )}}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{2 f}-\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{2 f}+\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{f}\) | \(263\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 117, normalized size = 1.43 \begin {gather*} -\frac {3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (3 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}\right )}}{\cos \left (f x + e\right )^{5} - \cos \left (f x + e\right )^{3}}}{12 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 178 vs.
\(2 (79) = 158\).
time = 3.45, size = 178, normalized size = 2.17 \begin {gather*} \frac {6 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 4 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, b^{2} - 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right )}{12 \, {\left (f \cos \left (f x + e\right )^{5} - f \cos \left (f x + e\right )^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \csc ^{3}{\left (e + f x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 254 vs.
\(2 (79) = 158\).
time = 0.84, size = 254, normalized size = 3.10 \begin {gather*} -\frac {\frac {3 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - 6 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - \frac {3 \, {\left (a^{2} - \frac {2 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}{\cos \left (f x + e\right ) - 1} - \frac {16 \, {\left (6 \, a b + b^{2} + \frac {12 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {6 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {3 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1\right )}^{3}}}{24 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.61, size = 188, normalized size = 2.29 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (\frac {a^2}{2}+2\,b\,a\right )}{f}+\frac {a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2}{8\,f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (\frac {3\,a^2}{2}+32\,b\,a\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\,\left (\frac {a^2}{2}+16\,a\,b+8\,b^2\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {3\,a^2}{2}+16\,a\,b+\frac {8\,b^2}{3}\right )+\frac {a^2}{2}}{f\,\left (-4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8+12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6-12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________